using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FiltronASP.Models.DAO.Interfaces;

namespace FiltronASP.Models.DAO.Extensions
{
    /// <summary>
    /// Klasa zawierajaca rozszerzenia metod zwiazanych z tabela galerii.
    /// </summary>
    public static class GalleryExtensions
    {

        /// <summary>
        /// Metoda pomocnicza pobieraja obrazki dla danej strony.
        /// </summary>
        /// <param name="gallery">galeria</param>
        /// <param name="pageId">id strony</param>
        /// <returns>obrazki dla danej strony</returns>
        public static IQueryable<GalleryImage> GetImages(this Gallery gallery, int? pageId)
        {
            if (gallery == null)
            {
                return null;
            }   //if
            if (pageId == null)
            {
                return null;
            }   //if
            IGalleryImageDAO galleryImageDAO = new GalleryImageDAO();
            return galleryImageDAO.FindByGalleryAndPage(gallery.gallery_id, pageId.Value);
        }

    }
}
